﻿using System;
using Yyd.Security.Claims;

namespace Volo.Abp.Users
{
    public static class YydCurrentUserExtensions
    {
        /// <summary>
        /// 获取当前用户所在的 组织单元Id
        /// </summary>
        /// <param name="currentUser"></param>
        /// <returns></returns>
        public static Guid? OrganizationUnitId(this ICurrentUser currentUser)
        {
            var value = currentUser.FindClaimValue(YydClaimTypes.OrganizationUnitId);
            return value == null ? default(Guid?) : new Guid(value);
        }
    }
}
